/**
 */
package org.xtext.mydsl.scheduler.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import org.xtext.mydsl.scheduler.Conferencia;
import org.xtext.mydsl.scheduler.Dia;
import org.xtext.mydsl.scheduler.Espacio;
import org.xtext.mydsl.scheduler.Orador;
import org.xtext.mydsl.scheduler.SchedulerPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Conferencia</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.xtext.mydsl.scheduler.impl.ConferenciaImpl#getName <em>Name</em>}</li>
 *   <li>{@link org.xtext.mydsl.scheduler.impl.ConferenciaImpl#getOradores <em>Oradores</em>}</li>
 *   <li>{@link org.xtext.mydsl.scheduler.impl.ConferenciaImpl#getEspacios <em>Espacios</em>}</li>
 *   <li>{@link org.xtext.mydsl.scheduler.impl.ConferenciaImpl#getDias <em>Dias</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ConferenciaImpl extends MinimalEObjectImpl.Container implements Conferencia
{
  /**
   * The default value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected static final String NAME_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getName()
   * @generated
   * @ordered
   */
  protected String name = NAME_EDEFAULT;

  /**
   * The cached value of the '{@link #getOradores() <em>Oradores</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getOradores()
   * @generated
   * @ordered
   */
  protected EList<Orador> oradores;

  /**
   * The cached value of the '{@link #getEspacios() <em>Espacios</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getEspacios()
   * @generated
   * @ordered
   */
  protected EList<Espacio> espacios;

  /**
   * The cached value of the '{@link #getDias() <em>Dias</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getDias()
   * @generated
   * @ordered
   */
  protected EList<Dia> dias;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ConferenciaImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return SchedulerPackage.Literals.CONFERENCIA;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getName()
  {
    return name;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setName(String newName)
  {
    String oldName = name;
    name = newName;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, SchedulerPackage.CONFERENCIA__NAME, oldName, name));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Orador> getOradores()
  {
    if (oradores == null)
    {
      oradores = new EObjectContainmentEList<Orador>(Orador.class, this, SchedulerPackage.CONFERENCIA__ORADORES);
    }
    return oradores;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Espacio> getEspacios()
  {
    if (espacios == null)
    {
      espacios = new EObjectContainmentEList<Espacio>(Espacio.class, this, SchedulerPackage.CONFERENCIA__ESPACIOS);
    }
    return espacios;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Dia> getDias()
  {
    if (dias == null)
    {
      dias = new EObjectContainmentEList<Dia>(Dia.class, this, SchedulerPackage.CONFERENCIA__DIAS);
    }
    return dias;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case SchedulerPackage.CONFERENCIA__ORADORES:
        return ((InternalEList<?>)getOradores()).basicRemove(otherEnd, msgs);
      case SchedulerPackage.CONFERENCIA__ESPACIOS:
        return ((InternalEList<?>)getEspacios()).basicRemove(otherEnd, msgs);
      case SchedulerPackage.CONFERENCIA__DIAS:
        return ((InternalEList<?>)getDias()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case SchedulerPackage.CONFERENCIA__NAME:
        return getName();
      case SchedulerPackage.CONFERENCIA__ORADORES:
        return getOradores();
      case SchedulerPackage.CONFERENCIA__ESPACIOS:
        return getEspacios();
      case SchedulerPackage.CONFERENCIA__DIAS:
        return getDias();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case SchedulerPackage.CONFERENCIA__NAME:
        setName((String)newValue);
        return;
      case SchedulerPackage.CONFERENCIA__ORADORES:
        getOradores().clear();
        getOradores().addAll((Collection<? extends Orador>)newValue);
        return;
      case SchedulerPackage.CONFERENCIA__ESPACIOS:
        getEspacios().clear();
        getEspacios().addAll((Collection<? extends Espacio>)newValue);
        return;
      case SchedulerPackage.CONFERENCIA__DIAS:
        getDias().clear();
        getDias().addAll((Collection<? extends Dia>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case SchedulerPackage.CONFERENCIA__NAME:
        setName(NAME_EDEFAULT);
        return;
      case SchedulerPackage.CONFERENCIA__ORADORES:
        getOradores().clear();
        return;
      case SchedulerPackage.CONFERENCIA__ESPACIOS:
        getEspacios().clear();
        return;
      case SchedulerPackage.CONFERENCIA__DIAS:
        getDias().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case SchedulerPackage.CONFERENCIA__NAME:
        return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
      case SchedulerPackage.CONFERENCIA__ORADORES:
        return oradores != null && !oradores.isEmpty();
      case SchedulerPackage.CONFERENCIA__ESPACIOS:
        return espacios != null && !espacios.isEmpty();
      case SchedulerPackage.CONFERENCIA__DIAS:
        return dias != null && !dias.isEmpty();
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (name: ");
    result.append(name);
    result.append(')');
    return result.toString();
  }

} //ConferenciaImpl
